package day8;

import java.util.Scanner;

public interface Fruit {
    void product();
}

 class Apple implements Fruit{
     @Override
     public void product() {
         System.out.println("生成苹果汁");
     }
 }
class Watermelon implements Fruit{
    @Override
    public void product() {
        System.out.println("生成西瓜汁");
    }
}

class Test6{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入你想要的果汁！:");
        String str=sc.next();
        Fruit s=null;
        if (str.equals("苹果")){
            s=new Apple();
        }else if (str.equals("西瓜")){
            s=new Watermelon();
        }
        s.product();
    }
}
